﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using RedditWP.Reddit;
using Newtonsoft.Json;


namespace RedditWP
{
    public class MainViewModel : INotifyPropertyChanged
    {

        private List<SubReddit> _subReddits;
        public List<SubReddit> SubReddits
        {
            get { return _subReddits; }
            set
            {
                _subReddits = value;
                NotifyPropertyChanged("SubReddits");
            }
        }

        private Submission[] _submissionList;
        public Submission[] SubmissionList
        {
            get { return _submissionList; }
            set
            {
                _submissionList = value;
                NotifyPropertyChanged("SubmissionList");
            }
        }

        private List<Submission> _picsSubmissionList;

        public List<Submission> PicsSubmissionList
        {
            get { return _picsSubmissionList; }
            set
            {
                _picsSubmissionList = value;
                NotifyPropertyChanged("PicsSubmissionList");
            }
        }

        public MainViewModel()
        {
        }

        private void LoadRedditHomePage(string json)
        {

            Listing listing = JsonConvert.DeserializeObject<Listing>(json);
            SubmissionList = listing.data.children;
        }

        private void LoadSubReddits()
        {
            this.SubReddits = new List<SubReddit>();
            
            // for now, hardcoded list

            SubReddits.Add(new SubReddit("reddit.com.header.png", ""         , "reddit.com/"));
            SubReddits.Add(new SubReddit(""                     , "funny"    , "Funny"));
            SubReddits.Add(new SubReddit("reddit_politics.png"  , "politics" , "Politics"));
            SubReddits.Add(new SubReddit(""                     , "pics"     , "Pics"));
            SubReddits.Add(new SubReddit("reddit_askreddit.png" , "askreddit", "AskReddit"));
            SubReddits.Add(new SubReddit("reddit_wtf.png"       , "wtf"      , "WTF"));
            SubReddits.Add(new SubReddit("reddit_gaming.png"    , "gaming"   , "Gaming"));
            SubReddits.Add(new SubReddit("reddit_science.png"   , "science"  , "Science"));
            SubReddits.Add(new SubReddit("reddit_worldnews.png" , "worldnews", "WorldNews"));

        }

        private void LoadRedditPics(string json)
        {
            Listing listing = JsonConvert.DeserializeObject<Listing>(json);

            PicsSubmissionList = new List<Submission>(listing.data.children.Length);
            PicsSubmissionList.AddRange(listing.data.children);

            api.GetPageListing("http://www.reddit.com/r/pics/.json?count=25&after=" + listing.data.after, LoadMoreRedditPics);
        }

        private void LoadMoreRedditPics(string json)
        {

            Listing listing = JsonConvert.DeserializeObject<Listing>(json);

            PicsSubmissionList.AddRange(listing.data.children);
        
            NotifyPropertyChanged("PicsSubmissionList");
        }

        public bool IsDataLoaded
        {
            get;
            private set;
        }

        private RedditApi api;

        /// <summary>
        /// Creates and adds a few ItemViewModel objects into the Items collection.
        /// </summary>
        public void LoadData()
        {
            //string json;
            api = new RedditApi();
            api.GetPageListing("http://www.reddit.com/.json", LoadRedditHomePage);

            // offline version
            //json = "{\"kind\": \"Listing\", \"data\": {\"modhash\": \"9qkzh36cz83b6787d7d281f3cf123c74d5c00145ecb5a09b38\", \"children\": [{\"kind\": \"t3\", \"data\": {\"domain\": \"reddit.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"politics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e4812\", \"clicked\": false, \"author\": \"hyperbovine\", \"media\": null, \"score\": 1612, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"\", \"subreddit_id\": \"t5_2cneq\", \"downs\": 1309, \"is_self\": false, \"permalink\": \"/r/politics/comments/e4812/its_time_reddit/\", \"name\": \"t3_e4812\", \"created\": 1289446934.0, \"url\": \"http://www.reddit.com/r/reddit.com/comments/e412v/a_flight_attendants_union_with_2000_members_is/c154ybg\", \"title\": \"It's time, Reddit.\", \"created_utc\": 1289421734.0, \"num_comments\": 283, \"ups\": 2921}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"WTF\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e42tp\", \"clicked\": false, \"author\": \"lughnasadh\", \"media\": null, \"score\": 2375, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"\", \"subreddit_id\": \"t5_2qh61\", \"downs\": 7210, \"is_self\": false, \"permalink\": \"/r/WTF/comments/e42tp/this_pretty_neatly_illustrates_who_is_really_in/\", \"name\": \"t3_e42tp\", \"created\": 1289430276.0, \"url\": \"http://imgur.com/GCNy7.jpg\", \"title\": \"This pretty neatly illustrates who is really in charge.\", \"created_utc\": 1289405076.0, \"num_comments\": 1001, \"ups\": 9585}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"i.imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e44hz\", \"clicked\": false, \"author\": \"iAmNotFunny\", \"media\": null, \"score\": 1573, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e44hz.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 3131, \"is_self\": false, \"permalink\": \"/r/pics/comments/e44hz/til_that_you_can_only_click_on_the_next_link_at/\", \"name\": \"t3_e44hz\", \"created\": 1289435547.0, \"url\": \"http://i.imgur.com/uOidD.png\", \"title\": \"TIL that you can only click on the \\\"next\\\" link at the bottom of reddit 42 times. Guess what happens after the 42th time?\", \"created_utc\": 1289410347.0, \"num_comments\": 326, \"ups\": 4704}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"abc15.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"reddit.com\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e412v\", \"clicked\": false, \"author\": \"sigmoid\", \"media\": null, \"score\": 1804, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"\", \"subreddit_id\": \"t5_6\", \"downs\": 2921, \"is_self\": false, \"permalink\": \"/r/reddit.com/comments/e412v/a_flight_attendants_union_with_2000_members_is/\", \"name\": \"t3_e412v\", \"created\": 1289423913.0, \"url\": \"http://www.abc15.com/dpp/lifestyle/travel/flight-attendants-union-upset-over-new-pat-down-procedures\", \"title\": \"A flight attendants union with 2,000 members is upset over what it calls \\\"invasive pat-downs\\\" recently implemented by the TSA\", \"created_utc\": 1289398713.0, \"num_comments\": 1015, \"ups\": 4725}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"funny\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e42ie\", \"clicked\": false, \"author\": \"n8opoly\", \"media\": null, \"score\": 1156, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"\", \"subreddit_id\": \"t5_2qh33\", \"downs\": 3568, \"is_self\": false, \"permalink\": \"/r/funny/comments/e42ie/so_my_pregnant_wife_sent_me_a_text_today/\", \"name\": \"t3_e42ie\", \"created\": 1289429180.0, \"url\": \"http://imgur.com/us53m.png\", \"title\": \"So my pregnant wife sent me a text today...\", \"created_utc\": 1289403980.0, \"num_comments\": 1007, \"ups\": 4724}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"eastbayexpress.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"science\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e449s\", \"clicked\": false, \"author\": \"superdude4agze\", \"media\": null, \"score\": 730, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"\", \"subreddit_id\": \"t5_mouw\", \"downs\": 709, \"is_self\": false, \"permalink\": \"/r/science/comments/e449s/recent_story_about_the_proficiency_of_black/\", \"name\": \"t3_e449s\", \"created\": 1289434873.0, \"url\": \"http://www.eastbayexpress.com/gyrobase/rich-black-flunking/Content?oid=1070459&amp;showFullText=true\", \"title\": \"Recent Story About the Proficiency of Black Students Only Leads to Questions. - Cal Professor John Ogbu thinks he knows why even rich black kids are failing in school. Nobody wants to hear it. - Rich, Black, Flunking\", \"created_utc\": 1289409673.0, \"num_comments\": 772, \"ups\": 1439}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"self.AskReddit\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"AskReddit\", \"selftext_html\": \"&lt;!-- SC_OFF --&gt;&lt;div class=\\\"md\\\"&gt;&lt;p&gt;Hello,&lt;/p&gt;\n\n&lt;p&gt;   My father recently passed away and my family is trying to find a episode of wheel of fortune he was on.  His name is Jeff Varn and the year we believe was 1984.  I am not sure if it was the day or night show.  I have posted on Sony forums and searched every search engine I know.  I also looked through every movie up loader I know like youtube.  If anyone could please help it would really help our family in the grieving process to see him so happy.&lt;/p&gt;\n\n&lt;p&gt;Thanks,&lt;/p&gt;\n\n&lt;p&gt;B&lt;/p&gt;&lt;/div&gt;&lt;!-- SC_ON --&gt;\", \"selftext\": \"Hello,\n\n   My father recently passed away and my family is trying to find a episode of wheel of fortune he was on.  His name is Jeff Varn and the year we believe was 1984.  I am not sure if it was the day or night show.  I have posted on Sony forums and searched every search engine I know.  I also looked through every movie up loader I know like youtube.  If anyone could please help it would really help our family in the grieving process to see him so happy.\n\n\nThanks,\n\nB\", \"likes\": null, \"saved\": false, \"id\": \"e45je\", \"clicked\": false, \"author\": \"PaNcEtTa\", \"media\": null, \"score\": 520, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"\", \"subreddit_id\": \"t5_2qh1i\", \"downs\": 482, \"is_self\": true, \"permalink\": \"/r/AskReddit/comments/e45je/my_father_recently_passed_and_my_family_is_trying/\", \"name\": \"t3_e45je\", \"created\": 1289438785.0, \"url\": \"http://www.reddit.com/comments/e45je/my_father_recently_passed_and_my_family_is_trying/\", \"title\": \"My father recently passed and my family is trying to find a episode of wheel of fortune he was on during 1984.\", \"created_utc\": 1289413585.0, \"num_comments\": 254, \"ups\": 1002}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"blog.reddit.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"blog\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e46ix\", \"clicked\": false, \"author\": \"raldi\", \"media\": null, \"score\": 246, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e46ix.png\", \"subreddit_id\": \"t5_2qh49\", \"downs\": 461, \"is_self\": false, \"permalink\": \"/r/blog/comments/e46ix/ma_soovin_rooga_milles_oleks_suur_sealiha/\", \"name\": \"t3_e46ix\", \"created\": 1289441845.0, \"url\": \"http://blog.reddit.com/2010/11/cmon-mexico-why-cant-you-be-more-like.html\", \"title\": \"Ma soovin rooga milles oleks suur sealiha.\", \"created_utc\": 1289416645.0, \"num_comments\": 347, \"ups\": 707}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"chetansurpur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"programming\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e3you\", \"clicked\": false, \"author\": \"HNcopypaste\", \"media\": null, \"score\": 893, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"\", \"subreddit_id\": \"t5_2fwo\", \"downs\": 855, \"is_self\": false, \"permalink\": \"/r/programming/comments/e3you/life_hack_the_3030_minute_work_cycle_feels_like/\", \"name\": \"t3_e3you\", \"created\": 1289409565.0, \"url\": \"http://chetansurpur.com/blog/2010/11/magic-work-cycle.html\", \"title\": \"Life Hack - The 30/30 Minute Work Cycle Feels Like Magic\", \"created_utc\": 1289384365.0, \"num_comments\": 512, \"ups\": 1748}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"en.wikipedia.org\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"programming\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e43f3\", \"clicked\": false, \"author\": \"mcantelon\", \"media\": null, \"score\": 265, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"\", \"subreddit_id\": \"t5_2fwo\", \"downs\": 172, \"is_self\": false, \"permalink\": \"/r/programming/comments/e43f3/in_the_2000_film_python_a_snake_terrorizes_the/\", \"name\": \"t3_e43f3\", \"created\": 1289432145.0, \"url\": \"http://en.wikipedia.org/wiki/Python_%28film%29\", \"title\": \"In the 2000 film \u201cPython,\u201d a snake terrorizes the town of \u201cRuby.\u201d\", \"created_utc\": 1289406945.0, \"num_comments\": 60, \"ups\": 437}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"28.media.tumblr.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"funny\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e45mw\", \"clicked\": false, \"author\": \"kiamatthews\", \"media\": null, \"score\": 632, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"\", \"subreddit_id\": \"t5_2qh33\", \"downs\": 719, \"is_self\": false, \"permalink\": \"/r/funny/comments/e45mw/saw_this_while_walking_to_lunch_did_a_double_take/\", \"name\": \"t3_e45mw\", \"created\": 1289439077.0, \"url\": \"http://28.media.tumblr.com/tumblr_lbol4yWr6E1qz7srjo1_400.jpg\", \"title\": \"Saw this while walking to lunch. Did a double take. Then did the walk backwards hold on did I just see what I think I saw thing.\n\nOutstanding. Flawless execution.\", \"created_utc\": 1289413877.0, \"num_comments\": 126, \"ups\": 1351}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"27bslash6.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"funny\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e413m\", \"clicked\": false, \"author\": \"clickclick\", \"media\": null, \"score\": 991, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"\", \"subreddit_id\": \"t5_2qh33\", \"downs\": 1094, \"is_self\": false, \"permalink\": \"/r/funny/comments/e413m/i_am_sick_to_death_of_dealing_with_you_designers/\", \"name\": \"t3_e413m\", \"created\": 1289424006.0, \"url\": \"http://www.27bslash6.com/bob.html\", \"title\": \"\\\"I am sick to death of dealing with you designers. Being able to draw and dressing like women doesn't make you special.\\\"\", \"created_utc\": 1289398806.0, \"num_comments\": 438, \"ups\": 2085}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"lewrockwell.com\", \"media_embed\": {\"content\": \"&lt;object width=\\\"600\\\" height=\\\"363\\\"&gt;&lt;param name=\\\"movie\\\" value=\\\"http://www.youtube.com/v/LlXPIgwSKIk?fs=1\\\"&gt;&lt;/param&gt;&lt;param name=\\\"allowFullScreen\\\" value=\\\"true\\\"&gt;&lt;/param&gt;&lt;param name=\\\"allowscriptaccess\\\" value=\\\"always\\\"&gt;&lt;/param&gt;&lt;embed src=\\\"http://www.youtube.com/v/LlXPIgwSKIk?fs=1\\\" type=\\\"application/x-shockwave-flash\\\" width=\\\"600\\\" height=\\\"363\\\" allowscriptaccess=\\\"always\\\" allowfullscreen=\\\"true\\\"&gt;&lt;/embed&gt;&lt;/object&gt;\", \"width\": 600, \"scrolling\": false, \"height\": 363}, \"levenshtein\": null, \"subreddit\": \"reddit.com\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e45r3\", \"clicked\": false, \"author\": \"Rhiannon\", \"media\": {\"oembed\": {\"provider_url\": \"http://www.youtube.com/\", \"description\": \"Check Out Jons Channel:\nhttp://www.youtube.com/user/portlandactor\n\nGood Luck buddy hope this reposting helps\", \"title\": \"TSA Forces Mother in Wheelchair to Tears with \\\"Enhanced Patdown\\\" Portland\", \"url\": \"http://www.youtube.com/watch?v=LlXPIgwSKIk\", \"type\": \"video\", \"author_name\": \"george4title\", \"height\": 363, \"width\": 600, \"html\": \"&lt;object width=\\\"600\\\" height=\\\"363\\\"&gt;&lt;param name=\\\"movie\\\" value=\\\"http://www.youtube.com/v/LlXPIgwSKIk?fs=1\\\"&gt;&lt;/param&gt;&lt;param name=\\\"allowFullScreen\\\" value=\\\"true\\\"&gt;&lt;/param&gt;&lt;param name=\\\"allowscriptaccess\\\" value=\\\"always\\\"&gt;&lt;/param&gt;&lt;embed src=\\\"http://www.youtube.com/v/LlXPIgwSKIk?fs=1\\\" type=\\\"application/x-shockwave-flash\\\" width=\\\"600\\\" height=\\\"363\\\" allowscriptaccess=\\\"always\\\" allowfullscreen=\\\"true\\\"&gt;&lt;/embed&gt;&lt;/object&gt;\", \"thumbnail_width\": 480, \"version\": \"1.0\", \"provider_name\": \"YouTube\", \"thumbnail_url\": \"http://i1.ytimg.com/vi/LlXPIgwSKIk/hqdefault.jpg\", \"thumbnail_height\": 360, \"author_url\": \"http://www.youtube.com/user/george4title\"}, \"type\": \"youtube.com\", \"deep\": \"http://www.lewrockwell.com/blog/lewrw/archives/69109.html\"}, \"score\": 518, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"\", \"subreddit_id\": \"t5_6\", \"downs\": 401, \"is_self\": false, \"permalink\": \"/r/reddit.com/comments/e45r3/tsa_thugs_force_elderly_mother_in_wheelchair_to/\", \"name\": \"t3_e45r3\", \"created\": 1289439456.0, \"url\": \"http://www.lewrockwell.com/blog/lewrw/archives/69109.html\", \"title\": \"TSA Thugs Force Elderly Mother in Wheelchair to Tears.  She's forced to stand-up, spread eagle, and have a rubber-gloved hand thrust up her crotch.  TSA threatens to arrest her if she doesn't stop crying.\", \"created_utc\": 1289414256.0, \"num_comments\": 206, \"ups\": 919}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"self.reddit.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"reddit.com\", \"selftext_html\": \"&lt;!-- SC_OFF --&gt;&lt;div class=\\\"md\\\"&gt;&lt;p&gt;The conversation has begun &lt;strong&gt;&lt;a href=\\\"http://www.reddit.com/r/OperationGrabAss\\\" &gt;here&lt;/a&gt;&lt;/strong&gt; Have your voice heard and stop this Ass Grabbery! Copy? Images? Approach? Fundraising?&lt;/p&gt;&lt;/div&gt;&lt;!-- SC_ON --&gt;\", \"selftext\": \"The conversation has begun **[here](http://www.reddit.com/r/OperationGrabAss)** Have your voice heard and stop this Ass Grabbery! Copy? Images? Approach? Fundraising?\n\", \"likes\": null, \"saved\": false, \"id\": \"e4a5n\", \"clicked\": false, \"author\": \"YouveBeenOneUpped\", \"media\": null, \"score\": 203, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"\", \"subreddit_id\": \"t5_6\", \"downs\": 61, \"is_self\": true, \"permalink\": \"/r/reddit.com/comments/e4a5n/help_reddit_create_a_nyt_ad_against_the_tsas/\", \"name\": \"t3_e4a5n\", \"created\": 1289454567.0, \"url\": \"http://www.reddit.com/comments/e4a5n/help_reddit_create_a_nyt_ad_against_the_tsas/\", \"title\": \"Help Reddit create a NYT ad against the TSA's invasive procedures!\", \"created_utc\": 1289429367.0, \"num_comments\": 8, \"ups\": 264}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"i.imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e48l3\", \"clicked\": false, \"author\": \"llathrop\", \"media\": null, \"score\": 433, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e48l3.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 391, \"is_self\": false, \"permalink\": \"/r/pics/comments/e48l3/i_think_my_barista_is_fucking_with_me/\", \"name\": \"t3_e48l3\", \"created\": 1289448945.0, \"url\": \"http://i.imgur.com/kkwhy.jpg\", \"title\": \"I think my barista is fucking with me\", \"created_utc\": 1289423745.0, \"num_comments\": 140, \"ups\": 824}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"dvorak.org\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e469c\", \"clicked\": false, \"author\": \"thomaspain\", \"media\": null, \"score\": 487, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e469c.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 520, \"is_self\": false, \"permalink\": \"/r/pics/comments/e469c/tsa_reaches_2nd_base/\", \"name\": \"t3_e469c\", \"created\": 1289441041.0, \"url\": \"http://www.dvorak.org/blog/wp-content/uploads/2008/09/tsa_breast_groping1.jpg\", \"title\": \"TSA reaches 2nd base!\", \"created_utc\": 1289415841.0, \"num_comments\": 169, \"ups\": 1007}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"i.imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e4b0t\", \"clicked\": false, \"author\": \"subtonix\", \"media\": null, \"score\": 217, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e4b0t.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 84, \"is_self\": false, \"permalink\": \"/r/pics/comments/e4b0t/i_made_another_map_this_time_its_of_the_world_and/\", \"name\": \"t3_e4b0t\", \"created\": 1289458079.0, \"url\": \"http://i.imgur.com/EA4fk.png\", \"title\": \"I made another map.  This time it's of the world, and I hope it is offensive to every single one of you. \", \"created_utc\": 1289432879.0, \"num_comments\": 135, \"ups\": 301}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"i.imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e4aa9\", \"clicked\": false, \"author\": \"studiotwentysix\", \"media\": null, \"score\": 244, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e4aa9.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 150, \"is_self\": false, \"permalink\": \"/r/pics/comments/e4aa9/reddit_i_have_designed_an_airport_passenger_hoodie/\", \"name\": \"t3_e4aa9\", \"created\": 1289455102.0, \"url\": \"http://i.imgur.com/HjJFT.jpg\", \"title\": \"Reddit, I have designed an airport passenger hoodie.\", \"created_utc\": 1289429902.0, \"num_comments\": 42, \"ups\": 394}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"self.AskReddit\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"AskReddit\", \"selftext_html\": \"&lt;!-- SC_OFF --&gt;&lt;div class=\\\"md\\\"&gt;&lt;p&gt;I don't want them to touch my concealed weapon.&lt;/p&gt;&lt;/div&gt;&lt;!-- SC_ON --&gt;\", \"selftext\": \"I don't want them to touch my concealed weapon.\", \"likes\": null, \"saved\": false, \"id\": \"e4526\", \"clicked\": false, \"author\": \"millerlit\", \"media\": null, \"score\": 221, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"\", \"subreddit_id\": \"t5_2qh1i\", \"downs\": 246, \"is_self\": true, \"permalink\": \"/r/AskReddit/comments/e4526/if_i_go_through_airport_security_with_just_a/\", \"name\": \"t3_e4526\", \"created\": 1289437283.0, \"url\": \"http://www.reddit.com/comments/e4526/if_i_go_through_airport_security_with_just_a/\", \"title\": \"If I go through airport security with just a speedo on will they still pat me down?\", \"created_utc\": 1289412083.0, \"num_comments\": 367, \"ups\": 467}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"i.imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e45ke\", \"clicked\": false, \"author\": \"worff\", \"media\": null, \"score\": 507, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e45ke.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 531, \"is_self\": false, \"permalink\": \"/r/pics/comments/e45ke/something_for_the_slightly_younger_redditors_who/\", \"name\": \"t3_e45ke\", \"created\": 1289438854.0, \"url\": \"http://i.imgur.com/qY9Fm.jpg\", \"title\": \"Something for the slightly younger Redditors who might feel left out.\", \"created_utc\": 1289413654.0, \"num_comments\": 248, \"ups\": 1038}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"i.imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e460i\", \"clicked\": false, \"author\": \"diblasio1\", \"media\": null, \"score\": 461, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e460i.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 556, \"is_self\": false, \"permalink\": \"/r/pics/comments/e460i/fucking_hipsters/\", \"name\": \"t3_e460i\", \"created\": 1289440278.0, \"url\": \"http://i.imgur.com/8A25F.jpg\", \"title\": \"Fucking Hipsters\", \"created_utc\": 1289415078.0, \"num_comments\": 116, \"ups\": 1017}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"self.funny\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"funny\", \"selftext_html\": \"&lt;!-- SC_OFF --&gt;&lt;div class=\\\"md\\\"&gt;&lt;p&gt;My professor walked into the room and asked if we knew that old saying \\\"my dog ate my homework.\\\" Well apparently she has a 3-month old Westie that got a hold of our midterms which were in a folder, in a bag, on top of a chair. What was interesting was that she only went after the \\\"good\\\" papers. Most were just a little nibbled, but the only perfect score in the class didn't make it out so easily. &lt;a href=\\\"http://imgur.com/iZzX9.jpg\\\" &gt;Here's how I received my midterm today&lt;/a&gt;.&lt;/p&gt;\n\n&lt;p&gt;EDIT: Fixed that typo. It took me so long to realize why everyone was using that meme.&lt;/p&gt;&lt;/div&gt;&lt;!-- SC_ON --&gt;\", \"selftext\": \"My professor walked into the room and asked if we knew that old saying \\\"my dog ate my homework.\\\" Well apparently she has a 3-month old Westie that got a hold of our midterms which were in a folder, in a bag, on top of a chair. What was interesting was that she only went after the \\\"good\\\" papers. Most were just a little nibbled, but the only perfect score in the class didn't make it out so easily. [Here's how I received my midterm today](http://imgur.com/iZzX9.jpg).\n\nEDIT: Fixed that typo. It took me so long to realize why everyone was using that meme.\", \"likes\": null, \"saved\": false, \"id\": \"e47hu\", \"clicked\": false, \"author\": \"bostwickftw\", \"media\": null, \"score\": 183, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"\", \"subreddit_id\": \"t5_2qh33\", \"downs\": 159, \"is_self\": true, \"permalink\": \"/r/funny/comments/e47hu/i_received_my_last_midterm_grade_today_and/\", \"name\": \"t3_e47hu\", \"created\": 1289445110.0, \"url\": \"http://www.reddit.com/comments/e47hu/i_received_my_last_midterm_grade_today_and/\", \"title\": \"I received my last midterm grade today and thought you may like to see how it turned out.\", \"created_utc\": 1289419910.0, \"num_comments\": 134, \"ups\": 342}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e4148\", \"clicked\": false, \"author\": \"schlamele\", \"media\": null, \"score\": 932, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e4148.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 1585, \"is_self\": false, \"permalink\": \"/r/pics/comments/e4148/im_not_proud_of_it_but_why_all_the_hate/\", \"name\": \"t3_e4148\", \"created\": 1289424058.0, \"url\": \"http://imgur.com/xcLpX.jpg\", \"title\": \"I'm not proud of it, but why all the hate?\", \"created_utc\": 1289398858.0, \"num_comments\": 359, \"ups\": 2517}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"self.reddit.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"reddit.com\", \"selftext_html\": \"&lt;!-- SC_OFF --&gt;&lt;div class=\\\"md\\\"&gt;&lt;p&gt;I'm posting this here since theCHIVE editors browse Reddit for their content and they never seem to check their email...&lt;/p&gt;\n\n&lt;p&gt;I have two simple requests:&lt;/p&gt;\n\n&lt;ul&gt;\n&lt;li&gt;&lt;p&gt;Give Reddit a little credit for your images. I'm not saying that every post has to link back to Reddit, and obviously Reddit is full of reposts, but when you're reposting original content, maybe just put it at the top of the post. For example, on your \\\"Daily Randomness\\\" which usually consists of 30-40 images, just put \\\"via Reddit\\\" up at the top... just one mention. Really. What's great about Reddit is that when something is posted that's not original content, you can find the source in the comments, giving credit where credit's due...&lt;/p&gt;&lt;/li&gt;\n&lt;li&gt;&lt;p&gt;When you repost something, just don't slap your name on it! Take &lt;a href=\\\"http://i.imgur.com/LNCSY.png\\\" &gt;this image&lt;/a&gt; as an example. I created and submitted that yesterday to Reddit. Hundreds of blogs and tumblrs reposted that image, and I have no problem with that whatsoever. What bugs me is the \\\"Chive, Nick Jr. vs MTV. Screw you, MTV.\\\" This makes it look like I submitted it to you, which means you were the original site it was posted on (which it wasn't). Also, the image totally stood by itself, that \\\"screw you, MTV\\\" line was unnecessary, and again, you're making it appear as though the submitter (me) said that, when really it was one of your editors... When someone submits something like \\\"This is what happens when I browse Reddit\\\" just leave it as is! No need to change it to \\\"This is what happens when I browse theChive.\\\" If you're going to repost something that's fine, just don't make it look like people are submitting it to you! You're trying to make it appear as if your readers are coming up with some great OC, when in fact you're just a blog of reposts. There's nothing wrong with that, but don't try to appear as if you're something that you're not.&lt;/p&gt;&lt;/li&gt;\n&lt;/ul&gt;\n\n\n&lt;p&gt;TL;DR: Give Reddit a little credit, don't slap your name on things&lt;/p&gt;\n\n&lt;p&gt;Thanks.&lt;/p&gt;&lt;/div&gt;&lt;!-- SC_ON --&gt;\", \"selftext\": \"I'm posting this here since theCHIVE editors browse Reddit for their content and they never seem to check their email...\n\nI have two simple requests:\n\n* Give Reddit a little credit for your images. I'm not saying that every post has to link back to Reddit, and obviously Reddit is full of reposts, but when you're reposting original content, maybe just put it at the top of the post. For example, on your \\\"Daily Randomness\\\" which usually consists of 30-40 images, just put \\\"via Reddit\\\" up at the top... just one mention. Really. What's great about Reddit is that when something is posted that's not original content, you can find the source in the comments, giving credit where credit's due...\n\n* When you repost something, just don't slap your name on it! Take [this image](http://i.imgur.com/LNCSY.png) as an example. I created and submitted that yesterday to Reddit. Hundreds of blogs and tumblrs reposted that image, and I have no problem with that whatsoever. What bugs me is the \\\"Chive, Nick Jr. vs MTV. Screw you, MTV.\\\" This makes it look like I submitted it to you, which means you were the original site it was posted on (which it wasn't). Also, the image totally stood by itself, that \\\"screw you, MTV\\\" line was unnecessary, and again, you're making it appear as though the submitter (me) said that, when really it was one of your editors... When someone submits something like \\\"This is what happens when I browse Reddit\\\" just leave it as is! No need to change it to \\\"This is what happens when I browse theChive.\\\" If you're going to repost something that's fine, just don't make it look like people are submitting it to you! You're trying to make it appear as if your readers are coming up with some great OC, when in fact you're just a blog of reposts. There's nothing wrong with that, but don't try to appear as if you're something that you're not.\n\nTL;DR: Give Reddit a little credit, don't slap your name on things\n\nThanks.\", \"likes\": null, \"saved\": false, \"id\": \"e48rf\", \"clicked\": false, \"author\": \"camalex\", \"media\": null, \"score\": 168, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"\", \"subreddit_id\": \"t5_6\", \"downs\": 52, \"is_self\": true, \"permalink\": \"/r/reddit.com/comments/e48rf/a_message_to_thechive/\", \"name\": \"t3_e48rf\", \"created\": 1289449625.0, \"url\": \"http://www.reddit.com/comments/e48rf/a_message_to_thechive/\", \"title\": \"A message to theCHIVE\", \"created_utc\": 1289424425.0, \"num_comments\": 54, \"ups\": 220}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"montrealgazette.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"science\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e47k6\", \"clicked\": false, \"author\": \"sticknmove\", \"media\": null, \"score\": 144, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"\", \"subreddit_id\": \"t5_mouw\", \"downs\": 100, \"is_self\": false, \"permalink\": \"/r/science/comments/e47k6/extract_from_dandelion_roots_dug_out_of_lawns_by/\", \"name\": \"t3_e47k6\", \"created\": 1289445366.0, \"url\": \"http://www.montrealgazette.com/health/Doctor+dandy+idea+leads+promising+cancer+finding/3805715/story.html\", \"title\": \"Extract from dandelion roots dug out of lawns by a University of Windsor scientist and his students make cancer cells \\\"commit suicide.\\\"\", \"created_utc\": 1289420166.0, \"num_comments\": 85, \"ups\": 244}}], \"after\": \"t3_e47k6\", \"before\": null}}";
            //LoadRedditHomePage(json);

            LoadSubReddits();

            api.GetPageListing("http://www.reddit.com/r/pics/.json", LoadRedditPics);
            
            // offline version
            //string json = "{\"kind\": \"Listing\", \"data\": {\"modhash\": \"9k5yvnwg9a3c659a954e8819858f4e9860b43a8b893e6d319b\", \"children\": [{\"kind\": \"t3\", \"data\": {\"domain\": \"i.imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e4b0t\", \"clicked\": false, \"author\": \"subtonix\", \"media\": null, \"score\": 795, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e4b0t.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 562, \"is_self\": false, \"permalink\": \"/r/pics/comments/e4b0t/i_made_another_map_this_time_its_of_the_world_and/\", \"name\": \"t3_e4b0t\", \"created\": 1289458079.0, \"url\": \"http://i.imgur.com/EA4fk.png\", \"title\": \"I made another map.  This time it's of the world, and I hope it is offensive to every single one of you. \", \"created_utc\": 1289432879.0, \"num_comments\": 459, \"ups\": 1357}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"i.imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e44hz\", \"clicked\": false, \"author\": \"iAmNotFunny\", \"media\": null, \"score\": 1592, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e44hz.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 3540, \"is_self\": false, \"permalink\": \"/r/pics/comments/e44hz/til_that_you_can_only_click_on_the_next_link_at/\", \"name\": \"t3_e44hz\", \"created\": 1289435547.0, \"url\": \"http://i.imgur.com/uOidD.png\", \"title\": \"TIL that you can only click on the \\\"next\\\" link at the bottom of reddit 42 times. Guess what happens after the 42th time?\", \"created_utc\": 1289410347.0, \"num_comments\": 351, \"ups\": 5132}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"i.imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e4aa9\", \"clicked\": false, \"author\": \"studiotwentysix\", \"media\": null, \"score\": 404, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e4aa9.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 313, \"is_self\": false, \"permalink\": \"/r/pics/comments/e4aa9/reddit_i_have_designed_an_airport_passenger_hoodie/\", \"name\": \"t3_e4aa9\", \"created\": 1289455102.0, \"url\": \"http://i.imgur.com/HjJFT.jpg\", \"title\": \"Reddit, I have designed an airport passenger hoodie.\", \"created_utc\": 1289429902.0, \"num_comments\": 56, \"ups\": 717}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"i.imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e48l3\", \"clicked\": false, \"author\": \"llathrop\", \"media\": null, \"score\": 506, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e48l3.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 593, \"is_self\": false, \"permalink\": \"/r/pics/comments/e48l3/i_think_my_barista_is_fucking_with_me/\", \"name\": \"t3_e48l3\", \"created\": 1289448945.0, \"url\": \"http://i.imgur.com/kkwhy.jpg\", \"title\": \"I think my barista is fucking with me\", \"created_utc\": 1289423745.0, \"num_comments\": 171, \"ups\": 1099}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"dvorak.org\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e469c\", \"clicked\": false, \"author\": \"thomaspain\", \"media\": null, \"score\": 548, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e469c.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 613, \"is_self\": false, \"permalink\": \"/r/pics/comments/e469c/tsa_reaches_2nd_base/\", \"name\": \"t3_e469c\", \"created\": 1289441041.0, \"url\": \"http://www.dvorak.org/blog/wp-content/uploads/2008/09/tsa_breast_groping1.jpg\", \"title\": \"TSA reaches 2nd base!\", \"created_utc\": 1289415841.0, \"num_comments\": 191, \"ups\": 1161}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"i.imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e45ke\", \"clicked\": false, \"author\": \"worff\", \"media\": null, \"score\": 582, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e45ke.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 640, \"is_self\": false, \"permalink\": \"/r/pics/comments/e45ke/something_for_the_slightly_younger_redditors_who/\", \"name\": \"t3_e45ke\", \"created\": 1289438854.0, \"url\": \"http://i.imgur.com/qY9Fm.jpg\", \"title\": \"Something for the slightly younger Redditors who might feel left out.\", \"created_utc\": 1289413654.0, \"num_comments\": 283, \"ups\": 1222}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"i.imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e460i\", \"clicked\": false, \"author\": \"diblasio1\", \"media\": null, \"score\": 520, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e460i.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 675, \"is_self\": false, \"permalink\": \"/r/pics/comments/e460i/fucking_hipsters/\", \"name\": \"t3_e460i\", \"created\": 1289440278.0, \"url\": \"http://i.imgur.com/8A25F.jpg\", \"title\": \"Fucking Hipsters\", \"created_utc\": 1289415078.0, \"num_comments\": 130, \"ups\": 1195}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e4br1\", \"clicked\": false, \"author\": \"hawkshaw\", \"media\": null, \"score\": 181, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e4br1.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 60, \"is_self\": false, \"permalink\": \"/r/pics/comments/e4br1/which_one_of_you_bastards_works_in_the_fortune/\", \"name\": \"t3_e4br1\", \"created\": 1289461169.0, \"url\": \"http://imgur.com/Cbygb.jpg\", \"title\": \"Which one of you bastards works in the fortune cookie business?\", \"created_utc\": 1289435969.0, \"num_comments\": 36, \"ups\": 241}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"i.imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e48kp\", \"clicked\": false, \"author\": \"blergle\", \"media\": null, \"score\": 283, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e48kp.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 258, \"is_self\": false, \"permalink\": \"/r/pics/comments/e48kp/us_dept_of_molestation/\", \"name\": \"t3_e48kp\", \"created\": 1289448879.0, \"url\": \"http://i.imgur.com/UnREW.jpg\", \"title\": \"US Dept of Molestation\", \"created_utc\": 1289423679.0, \"num_comments\": 30, \"ups\": 541}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e4148\", \"clicked\": false, \"author\": \"schlamele\", \"media\": null, \"score\": 962, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e4148.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 1648, \"is_self\": false, \"permalink\": \"/r/pics/comments/e4148/im_not_proud_of_it_but_why_all_the_hate/\", \"name\": \"t3_e4148\", \"created\": 1289424058.0, \"url\": \"http://imgur.com/xcLpX.jpg\", \"title\": \"I'm not proud of it, but why all the hate?\", \"created_utc\": 1289398858.0, \"num_comments\": 365, \"ups\": 2610}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"flickr.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e3zmi\", \"clicked\": false, \"author\": \"ajehals\", \"media\": null, \"score\": 1341, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e3zmi.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 4431, \"is_self\": false, \"permalink\": \"/r/pics/comments/e3zmi/no_reddit_you_are_between_25_and_35_and_had_this/\", \"name\": \"t3_e3zmi\", \"created\": 1289416182.0, \"url\": \"http://www.flickr.com/photos/37271605@N02/3789507919/\", \"title\": \"No, reddit. You are between 25 and 35 and had *this* toy.\nThat is all.\", \"created_utc\": 1289390982.0, \"num_comments\": 1564, \"ups\": 5772}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"i.imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e410k\", \"clicked\": false, \"author\": \"iezugod\", \"media\": null, \"score\": 868, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e410k.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 1616, \"is_self\": false, \"permalink\": \"/r/pics/comments/e410k/dear_beverage_companies_please_stop_listing/\", \"name\": \"t3_e410k\", \"created\": 1289423615.0, \"url\": \"http://i.imgur.com/8umlC.jpg\", \"title\": \"Dear beverage companies: Please stop listing energy drinks as having 2 servings when they don't come in resealable containers.\", \"created_utc\": 1289398415.0, \"num_comments\": 507, \"ups\": 2484}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"i.imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e42kc\", \"clicked\": false, \"author\": \"Birthmark\", \"media\": null, \"score\": 634, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e42kc.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 1061, \"is_self\": false, \"permalink\": \"/r/pics/comments/e42kc/i_did_this_with_just_my_thumbs_proudest_day_of_my/\", \"name\": \"t3_e42kc\", \"created\": 1289429332.0, \"url\": \"http://i.imgur.com/9hUEvl.jpg\", \"title\": \"I did this with just my thumbs. Proudest day of my life.\", \"created_utc\": 1289404132.0, \"num_comments\": 235, \"ups\": 1695}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e4ajw\", \"clicked\": false, \"author\": \"aaronp1264\", \"media\": null, \"score\": 153, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e4ajw.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 103, \"is_self\": false, \"permalink\": \"/r/pics/comments/e4ajw/my_favorite_shade_of_scarlett/\", \"name\": \"t3_e4ajw\", \"created\": 1289456172.0, \"url\": \"http://imgur.com/PWktv.jpg\", \"title\": \"My Favorite Shade of Scarlett\", \"created_utc\": 1289430972.0, \"num_comments\": 56, \"ups\": 256}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e4aot\", \"clicked\": false, \"author\": \"SpelingTroll\", \"media\": null, \"score\": 145, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e4aot.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 105, \"is_self\": false, \"permalink\": \"/r/pics/comments/e4aot/too_subtle/\", \"name\": \"t3_e4aot\", \"created\": 1289456765.0, \"url\": \"http://imgur.com/I6XgB\", \"title\": \"Too subtle?\", \"created_utc\": 1289431565.0, \"num_comments\": 32, \"ups\": 250}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"i.imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e4407\", \"clicked\": false, \"author\": \"EthicalReasoning\", \"media\": null, \"score\": 373, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e4407.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 425, \"is_self\": false, \"permalink\": \"/r/pics/comments/e4407/tree_camping_pic/\", \"name\": \"t3_e4407\", \"created\": 1289434019.0, \"url\": \"http://i.imgur.com/dmLLy.jpg\", \"title\": \"Tree Camping (pic)\", \"created_utc\": 1289408819.0, \"num_comments\": 131, \"ups\": 798}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"i.imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e4aat\", \"clicked\": false, \"author\": \"mntbikeracer1\", \"media\": null, \"score\": 132, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e4aat.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 104, \"is_self\": false, \"permalink\": \"/r/pics/comments/e4aat/no_one_will_ever_see_my_packages_there_thanks_ups/\", \"name\": \"t3_e4aat\", \"created\": 1289455163.0, \"url\": \"http://i.imgur.com/KkJjZ.jpg\", \"title\": \"No One Will Ever See My Packages There...... Thanks UPS\", \"created_utc\": 1289429963.0, \"num_comments\": 47, \"ups\": 236}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"datelinezero.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e44nn\", \"clicked\": false, \"author\": \"thomaspain\", \"media\": null, \"score\": 305, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e44nn.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 392, \"is_self\": false, \"permalink\": \"/r/pics/comments/e44nn/tsa_frisking_nun/\", \"name\": \"t3_e44nn\", \"created\": 1289436048.0, \"url\": \"http://www.datelinezero.com/wp-content/uploads/2010/08/tsa-frisking-nun1.jpg\", \"title\": \"TSA Frisking Nun\", \"created_utc\": 1289410848.0, \"num_comments\": 150, \"ups\": 697}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"i.imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e41ot\", \"clicked\": false, \"author\": \"Lost_Soviet_Hero\", \"media\": null, \"score\": 424, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e41ot.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 726, \"is_self\": false, \"permalink\": \"/r/pics/comments/e41ot/i_was_waiting_for_a_bus_last_night_when_i_noticed/\", \"name\": \"t3_e41ot\", \"created\": 1289426243.0, \"url\": \"http://i.imgur.com/LL5NN.jpg\", \"title\": \"I was waiting for a bus last night when I noticed...\", \"created_utc\": 1289401043.0, \"num_comments\": 92, \"ups\": 1150}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e3z9e\", \"clicked\": false, \"author\": \"squandom\", \"media\": null, \"score\": 796, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e3z9e.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 1367, \"is_self\": false, \"permalink\": \"/r/pics/comments/e3z9e/found_this_at_the_bottom_of_a_fruit_smoothie/\", \"name\": \"t3_e3z9e\", \"created\": 1289413534.0, \"url\": \"http://imgur.com/F4l74.jpg\", \"title\": \"Found this at the bottom of a fruit smoothie carton.\", \"created_utc\": 1289388334.0, \"num_comments\": 161, \"ups\": 2163}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e42m4\", \"clicked\": false, \"author\": \"wickedcoolmatt\", \"media\": null, \"score\": 324, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e42m4.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 449, \"is_self\": false, \"permalink\": \"/r/pics/comments/e42m4/clever_reminder/\", \"name\": \"t3_e42m4\", \"created\": 1289429469.0, \"url\": \"http://imgur.com/HUclQ\", \"title\": \"Clever Reminder \", \"created_utc\": 1289404269.0, \"num_comments\": 25, \"ups\": 773}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e3ztp\", \"clicked\": false, \"author\": \"mattsbox60\", \"media\": null, \"score\": 552, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e3ztp.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 898, \"is_self\": false, \"permalink\": \"/r/pics/comments/e3ztp/this_box_was_very_distracting_at_my_chemistry/\", \"name\": \"t3_e3ztp\", \"created\": 1289417593.0, \"url\": \"http://imgur.com/hBTUK\", \"title\": \"This box was very distracting at my chemistry exam today.\", \"created_utc\": 1289392393.0, \"num_comments\": 125, \"ups\": 1450}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e4b3k\", \"clicked\": false, \"author\": \"theseabiscuit\", \"media\": null, \"score\": 71, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e4b3k.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 33, \"is_self\": false, \"permalink\": \"/r/pics/comments/e4b3k/fucking_hipsters_indeed/\", \"name\": \"t3_e4b3k\", \"created\": 1289458350.0, \"url\": \"http://imgur.com/CWFEJ.jpg\", \"title\": \"Fucking hipsters, indeed!\", \"created_utc\": 1289433150.0, \"num_comments\": 33, \"ups\": 104}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"iwdrm.tumblr.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e44q4\", \"clicked\": false, \"author\": \"phlip\", \"media\": null, \"score\": 194, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e44q4.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 145, \"is_self\": false, \"permalink\": \"/r/pics/comments/e44q4/awesome_subtle_animated_gifs/\", \"name\": \"t3_e44q4\", \"created\": 1289436261.0, \"url\": \"http://iwdrm.tumblr.com\", \"title\": \"Awesome &amp; Subtle Animated GIFs\", \"created_utc\": 1289411061.0, \"num_comments\": 26, \"ups\": 339}}, {\"kind\": \"t3\", \"data\": {\"domain\": \"imgur.com\", \"media_embed\": {}, \"levenshtein\": null, \"subreddit\": \"pics\", \"selftext_html\": null, \"selftext\": \"\", \"likes\": null, \"saved\": false, \"id\": \"e482q\", \"clicked\": false, \"author\": \"Badmojoe\", \"media\": null, \"score\": 107, \"over_18\": false, \"hidden\": false, \"thumbnail\": \"http://thumbs.reddit.com/t3_e482q.png\", \"subreddit_id\": \"t5_2qh0u\", \"downs\": 130, \"is_self\": false, \"permalink\": \"/r/pics/comments/e482q/most_exclusive_club_ever/\", \"name\": \"t3_e482q\", \"created\": 1289447103.0, \"url\": \"http://imgur.com/tDWKn.jpg\", \"title\": \"Most exclusive club ever.\", \"created_utc\": 1289421903.0, \"num_comments\": 24, \"ups\": 237}}], \"after\": \"t3_e482q\", \"before\": null}}";
            //LoadRedditPics(json);

            this.IsDataLoaded = true;
        }

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}